﻿using System;
using System.Drawing;
using System.Runtime.InteropServices;

internal class b
{
    private const int a = 3;
    private const int b = 0;
    private const int c = 2;
    private const int d = 1;
    private const int e = 5;
    private const uint f = 0x30;
    private b.b g;

    public b.c a()
    {
        return (b.c) this.g.d;
    }

    public void a(string A_0, string A_1)
    {
        this.g = new b.b();
        this.g.a = (uint) Marshal.SizeOf(this.g.GetType());
        if (FindWindow(A_0, A_1) == IntPtr.Zero)
        {
            throw new Exception("Failed to find an AppBar that matched the given criteria");
        }
        if (SHAppBarMessage(5, ref this.g) != 1)
        {
            throw new Exception("Failed to communicate with the given AppBar");
        }
    }

    public Rectangle b()
    {
        int num = 0;
        b.a structure = new b.a();
        IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(structure));
        num = SystemParametersInfo(0x30, 0, ptr, 0);
        structure = (b.a) Marshal.PtrToStructure(ptr, structure.GetType());
        if (num == 1)
        {
            Marshal.FreeHGlobal(ptr);
            return new Rectangle(structure.a, structure.b, structure.c - structure.a, structure.d - structure.b);
        }
        return new Rectangle(0, 0, 0, 0);
    }

    public void c()
    {
        this.a("Shell_TrayWnd", null);
    }

    [DllImport("user32.dll")]
    private static extern IntPtr FindWindow(string A_0, string A_1);
    [DllImport("shell32.dll")]
    private static extern uint SHAppBarMessage(uint A_0, ref b.b A_1);
    [DllImport("user32.dll")]
    private static extern int SystemParametersInfo(uint A_0, uint A_1, IntPtr A_2, uint A_3);

    [StructLayout(LayoutKind.Sequential)]
    private struct a
    {
        public int a;
        public int b;
        public int c;
        public int d;
    }

    [StructLayout(LayoutKind.Sequential)]
    private struct b
    {
        public uint a;
        public IntPtr b;
        public uint c;
        public uint d;
        public b.a e;
        public int f;
    }

    public enum c
    {
        a = -1,
        b = 0,
        c = 1,
        d = 2,
        e = 3
    }
}

